package com.ruoyi.vplat.controller;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import com.alibaba.fastjson.JSONObject;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.vplat.service.IVplatVideoService;

/**
 * 设备Controller
 * 
 * @author ruoyi
 * @date 2024-04-29
 */
@RestController
@RequestMapping("/vplat/video")
public class VplatVideoController extends BaseController
{
    @Autowired
    private IVplatVideoService vplatVideoService;
    
    /**
     * 播放视频
     */
    @PreAuthorize("@ss.hasPermi('vplat:video:playVideo')")
    @GetMapping("/playVideo")
    public JSONObject playVideo(@RequestParam Map<String, Object> param) throws Exception
    {
		return vplatVideoService.playVideo(param);
    }
    /**
     * 关闭视频
     */
    @PreAuthorize("@ss.hasPermi('vplat:video:closeVideo')")
    @GetMapping("/closeVideo")
    public JSONObject closeVideo(@RequestParam Map<String, Object> param) throws Exception
    {
		return vplatVideoService.closeVideo(param);
    }
    /**
     * 开始录像
     */
    @PreAuthorize("@ss.hasPermi('vplat:video:startRecord')")
    @PostMapping("/startRecord")
    public JSONObject startRecord(@RequestBody Map<String, Object> param) throws Exception
    {

        return vplatVideoService.startRecord(param);
    }
    /**
     * 停止录像
     */
    @PreAuthorize("@ss.hasPermi('vplat:video:stopRecord')")
    @PostMapping("/stopRecord")
    public JSONObject stopRecord(@RequestBody Map<String, Object> param) throws Exception
    {

        return vplatVideoService.stopRecord(param);
    }
    /**
     * 录像回放(开始推流)
     */
    @PreAuthorize("@ss.hasPermi('vplat:video:startHistoryRecord')")
    @PostMapping("/startHistoryRecord")
    public JSONObject startHistoryRecord(@RequestBody Map<String, Object> param) throws Exception
    {
		return vplatVideoService.startHistoryRecord(param);
    }
    /**
     * 停止录像回放(停止推流)
     */
    @PreAuthorize("@ss.hasPermi('vplat:video:stopHistoryRecord')")
    @PostMapping("/stopHistoryRecord")
    public JSONObject stopHistoryRecord(@RequestBody Map<String, Object> param) throws Exception
    {
		return vplatVideoService.stopHistoryRecord(param);
    }
    /**
     * 云台控制
     */
    @PreAuthorize("@ss.hasPermi('vplat:video:control')")
    @PostMapping("/control")
    public JSONObject control(@RequestBody Map<String, Object> param) throws Exception
    {
		return vplatVideoService.control(param);
    }
    /**
     * 获取球机PTZ值
     */
    @PreAuthorize("@ss.hasPermi('vplat:video:getPTZ')")
    @GetMapping("/getPTZ")
    public JSONObject getPTZ(@RequestParam Map<String, Object> param) throws Exception
    {
        return vplatVideoService.getPTZ(param);
    }
    /**
     * 设置球机PTZ值
     */
    @PreAuthorize("@ss.hasPermi('vplat:video:setPTZ')")
    @PostMapping("/setPTZ")
    public JSONObject setPTZ(@RequestBody Map<String, Object> param) throws Exception
    {
        return vplatVideoService.setPTZ(param);
    }


}
